import { splitToLength, BoolStrWithBoolen } from '../../../Utils/common'
export function sub3(data) {
  console.log('************convertWithSub3-1 in************************')
  const { attr43, attr44, attr45 } = data
  let str = ''
  console.log('************convertWithSub3-2 ************************')
  str += attr43Convert(attr43)
  // TODO默认值
  console.log('************convertWithSub3-3 ************************')
  str += `过去4周睡眠过程中${
    BoolStrWithBoolen(attr44) ? '有' : '没有'
  }因为咳嗽、气喘醒来。`
  if (attr45) str += `其他: ${attr45}。`
  console.log('************convertWithSub3-1 out************************')
  return str
}
function attr43Convert(attr43) {
  if (splitToLength(attr43, 2)) {
    return '晨起、晚上尤其是入睡后症状好发或加重，'
  } else if (attr43 && attr43.includes('症状晨起好发或加重')) {
    return '晨起症状好发或加重，'
  } else if (attr43 && attr43.includes('症状晚上尤其是入睡后好发或加重')) {
    return '晚上尤其是入睡后症状好发或加重，'
  }
  return ''
}
// /**
//  * 时间节律性
//  */
// export function sub3(data) {
//   const { attr43, attr44, attr45 } = data
//   // attr43 "症状晨起好发或加重,症状晚上尤其是入睡后好发或加重"
//   return {
//     ...attr43Convert(43),
//     wakeUpByAsthma: BoolStrWithBoolen(attr44),
//     timeRhythmRemark: attr45,
//   }
// }

// function attr43Convert(str) {
//   if (splitToLength(str, 2)) {
//     return { morning: true, evening: true }
//   } else {
//     const morning = str.includes('症状晨起好发或加重') ? true : false
//     const evening = str.includes('症状晚上尤其是入睡后好发或加重') ? true : false
//     return { morning, evening }
//   }
// }
